package com.server.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;



/**
 * The persistent class for the Item database table.
 * 
 */
@Entity
@XmlRootElement
@NamedQueries({@NamedQuery(name="GetAllItems",query="select e from Item e"),
		@NamedQuery(name="GetImages",query="select s from City s")})
@Table(schema="mhp")
public class Item implements Serializable {
	private static final long serialVersionUID = 1L;

	
/*    @TableGenerator(
            name="ITEM_TABLE_GENERATOR", 
            table="ITEM", 
            pkColumnValue="ADDRESS_SEQ"
        )
    @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="ITEM_TABLE_GENERATOR")*/
	@Id
    @Column(name="ItemID")
	private String itemId;

	private String itemName;
	
		
	@OneToMany(mappedBy="item",cascade={CascadeType.PERSIST,CascadeType.MERGE})
	private List<ItemImage> images;
	
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name="itemId",insertable=false, updatable=false)
	private ItemType itemType;
	
	@ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name="ItemId",insertable=false, updatable=false)
	private City city;
	
	@OneToMany(mappedBy="item",cascade={CascadeType.PERSIST,CascadeType.MERGE})
	private List<ItemComment> itemComments;
	
	public Item() {
	}

	public String getItemId() {
		return this.itemId;
	}

	public void setItemId(String itemId) {
		this.itemId = itemId;
	}

	public String getItemName() {
		return this.itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public List<ItemImage> getImages() {
		return images;
	}

	public void setImages(List<ItemImage> images) {
		this.images = images;
	}

	public ItemType getItemType() {
		return itemType;
	}

	public void setItemType(ItemType itemType) {
		this.itemType = itemType;
	}

	public City getCity() {
		return city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public List<ItemComment> getItemComments() {
		return itemComments;
	}

	public void setItemComments(List<ItemComment> itemComments) {
		this.itemComments = itemComments;
	}
	
	

}